package com.goldmantis.alitrip.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.goldmantis.alitrip.common.BaseService;
import com.goldmantis.alitrip.mapper.SysUserMapper;
import com.goldmantis.alitrip.pojo.SysUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author:Shmily
 * @Description:
 * @Date:Create in 9:46 2018/2/11
 */
@Service
public class SysUserService extends BaseService<SysUser> {

    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    public PageInfo<SysUser> pageList(SysUser t, Integer offset, Integer limit){
        PageHelper.startPage(offset,limit);
        if(StringUtils.isBlank(t.getRoleNames())){
            t.setRoleNames(null);
        }
        List<SysUser> sysUsers = this.sysUserMapper.getCustom(t);
        return new PageInfo(sysUsers);
    }


    public List<Map> exceltodata (SysUser t){
        return this.sysUserMapper.exceltodata(t);

    }
}
